package com.ntschy.bt.entity.enums.btpolicyEnum;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * @author lxr
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum BtPolicyStatusEnum implements IEnum<Integer> {
    /**
     * 状态 1-已提交 2-待审核 3-已完成
     */
    TO_COMMIT(1, "已保存"),
    TO_CHECK(2, "待审核"),
    TO_BACK(3, "已退回"),
    FINISHED(4, "已通过");

    private final int value;

    private final String desc;

    BtPolicyStatusEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    public String getDesc() {
        return desc;
    }

    @JsonCreator
    public static BtPolicyStatusEnum getBtPolicyStatusEnumValue(int value) {
        for (BtPolicyStatusEnum companyStatus : BtPolicyStatusEnum.values()) {
            if (companyStatus.getValue() == value) {
                return companyStatus;
            }
        }
        return null;
    }
}
